home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / wndwc20.zip / QWIKC20.H < prev    next >
Text File  |  1989-03-06  |  9KB  |  236 lines

  1. /*===========================================================================*\
  2. | QWIKC20.H                                                ver 2.0c, 01-06-89 |
  3. |                                                                             |
  4. | Header file for quick, direct screen writing for C                          |
  5. | Copyright (c)1988-1989 James H. LeMay, All rights reserved.                 |
  6. |                                                                             |
  7. | Conversion to C by Jordan Gallagher/Wisdom Research                         |
  8. |                                                                             |
  9. | For documentation on this file see QWIKC20.DOC and QWIKREF.DOC.             |
  10. | Only 44 bytes of global data are used.                                      |
  11. \*===========================================================================*/
  12.  
  13. #ifndef __DOS_DEF_
  14. #include <dos.h>                  /* DOS.H needed for MK_FP below! */
  15. #endif
  16.  
  17. #define videomode   *(char far *)MK_FP(0x0000,0x0449) /* Video mode:
  18.                                                          Mono=7, Color=0-3 */
  19. #define videopage   *(char far *)MK_FP(0x0000,0x0462) /* Video page number */
  20. #define egarows     *(char far *)MK_FP(0x0000,0x0484) /* Rows on screen
  21.                                                          (0-based) */
  22. #define egainfo     *(char far *)MK_FP(0x0000,0x0487) /* EGA info.
  23.                                                          See QWIKREF.DOC */
  24. #define egafontsize *(int far *)MK_FP(0x0000,0x0485)  /* Character cell height
  25.                                                          (1-based) */
  26. #define crtcolumns  *(int far *)MK_FP(0x0000,0x0044)  /* Number of CRT columns
  27.                                                          (1-based) */
  28.  
  29. extern unsigned char system_id, /* Equipment ID.  See QWIKREF.DOC */
  30. submodel_id,                    /* Equipment ID.  See QWIKREF.DOC */
  31. cpuid,                       /* Model number of Intel CPU */
  32. qvideo_mode,                 /* Video mode detected by Qwik */
  33. qvideo_page,                 /* Video page to which Qwik is writing */
  34. maxpage,                     /* Maximum possible page */
  35. cardsnow,                    /* Wait-for-retrace (snow) for video card */
  36. have_ps2,                    /* Using some type of IBM PS/2 equip */
  37. have_3270,                   /* Using IBM 3270 PC workstation hard/software */
  38. ega_switches,                /* EGA card and monitor setup */
  39. active_disp_dev,             /* Active Display Device */
  40. active_disp_dev_3270,        /* Active Display Device for IBM 3270 PC */
  41. alt_disp_dev,                /* Alternate Display Device */
  42. herc_model,                  /* Model of Hercules card. */
  43. inmultask;                   /* Set to 1 if setmultitask() called in
  44.                                 multitasking environment */
  45. extern int page0seg;         /* Segment for page 0 for video card/buffer */
  46. extern int cardseg;          /* Segment for page 0 for video card */
  47. extern int alt_disp_dev_pcc; /* Alt Display Device for PC Convertible */
  48. extern int scroll_attr;      /* Attribute used to clear row in qeosln() */
  49.  
  50. typedef struct {
  51.     void far *vscrptr;     /* Pointer to memory writes are done to */
  52.     unsigned veosofs;      /* End Of String offset after Qwik writing */
  53.     unsigned vsize;        /* Essentially size of CRT video buffer in bytes */
  54.     unsigned char vrows;   /* Global variable of Rows/Ega rows (1-based!) */
  55.     unsigned char vcols;   /* Global variable of CRT columns (1-based) */
  56.     char vsnow;            /* Wait-for-retrace (snow) while Qwik writing */
  57. } vscr_t;
  58.  
  59. extern vscr_t qscr;
  60.  
  61. #define crt_rows qscr.vrows
  62. #define crt_cols qscr.vcols
  63. #define qsnow qscr.vsnow
  64. #define crt_size qscr.vsize
  65. #define qeosofs qscr.veosofs
  66. #define qscrofs *((unsigned *) (&qscr.vscrptr))
  67. #define qscrseg *((unsigned *) (&qscr.vscrptr)+1)
  68. #define qscrptr qscr.vscrptr
  69.  
  70. /* Constants assigned by IBM:              */
  71. enum {
  72.     no_display,          /* 00 through 0C, FF */
  73.     mda_mono,
  74.     cga_color,
  75.     dcc3,
  76.     ega_color,
  77.     ega_mono,
  78.     pgc_color,
  79.     vga_mono,
  80.     vga_color,
  81.     dcc9,
  82.     dcc10,
  83.     mcga_mono,
  84.     mcga_color,
  85.     unknown = 255
  86. };
  87.  
  88. /* Arbitrarily assigned constants: */
  89. enum {
  90.     no_herc,
  91.     hgc_mono,
  92.     hgc_plus,
  93.     herc_incolor
  94. };
  95.  
  96. enum {
  97.     cpu8086,
  98.     cpu80186,
  99.     cpu80286,
  100.     cpu80386
  101. };
  102.  
  103. /* These are the foreground text colors */
  104. #if !defined(__COLORS)
  105. #define __COLORS
  106.  
  107. enum COLORS {
  108.     BLACK,
  109.     BLUE,
  110.     GREEN,
  111.     CYAN,
  112.     RED,
  113.     MAGENTA,
  114.     BROWN,
  115.     LIGHTGRAY,
  116.     DARKGRAY,
  117.     LIGHTBLUE,
  118.     LIGHTGREEN,
  119.     LIGHTCYAN,
  120.     LIGHTRED,
  121.     LIGHTMAGENTA,
  122.     YELLOW,
  123.     WHITE
  124. };
  125. #endif
  126.  
  127. /* These are the background colors */
  128. enum {
  129.     BLACK_BG     = 0x00,
  130.     BLUE_BG      = 0x10,
  131.     GREEN_BG     = 0x20,
  132.     CYAN_BG      = 0x30,
  133.     RED_BG       = 0x40,
  134.     MAGENTA_BG   = 0x50,
  135.     BROWN_BG     = 0x60,
  136.     LIGHTGRAY_BG = 0x70
  137. };
  138.  
  139. #define  BLINK     128   /* blink bit -- add to attribute */
  140. #define  SAMEATTR  -1    /* supresses attribute changes to the screen */
  141.  
  142. /* The following are macros used in calling setcursor() and modcursor() */
  143. #define cursor_on    0x0000  /* Turns cursor on with same shape */
  144. #define cursor_off   0x2000  /* Turns cursor off with same shape */
  145. #define cursor_blink 0x6000  /* Creates erratic blinking for many machines */
  146.  
  147. /* These cursor modes are set by qinit() as detected for the video card: */
  148. extern int cursor_initial;         /* Cursor detected at startup */
  149. extern int cursor_underline;       /* Standard underline cursor */
  150. extern int cursor_halfblock;       /* Usually used for Insert editing */
  151. extern int cursor_block;           /* For those who have to squint */
  152.  
  153. /* ----------- QINIT ----------- */
  154. void qinit( void );
  155. void qreinit( void );
  156.  
  157. /* ----------- QWRITES ----------- */
  158. void qwrite(  unsigned char row, unsigned char col, int attr,
  159.               char far *astr );
  160. void qwritec( unsigned char row, unsigned char col, unsigned char cols,
  161.               int attr, char far *astr );
  162. void qwriteeos( int attr, char far *astr );
  163.  
  164. /* ----------- QWRSUB ----------- */
  165. void qwrite_sub( unsigned char row, unsigned char col, int attr, int length,
  166.                  char far *astr );
  167. void qwriteeos_sub( int attr, int length, char far *astr );
  168.  
  169. /* ----------- QFILLS ----------- */
  170. void qfill(  unsigned char row, unsigned char col, unsigned char rows,
  171.              unsigned char cols, int attr, char ch );
  172. void qattr(  unsigned char row, unsigned char col, unsigned char rows,
  173.              unsigned char cols, int attr );
  174. void qfillc( unsigned char row, unsigned char col_l, unsigned char col_r,
  175.              unsigned char rows, unsigned char cols, int attr, char ch );
  176. void qattrc( unsigned char row, unsigned char col_l, unsigned char col_r,
  177.              unsigned char rows, unsigned char cols, int attr );
  178. void qfilleos( unsigned char rows, unsigned char cols, int attr, char ch );
  179. void qattreos( unsigned char rows, unsigned char cols, int attr );
  180.  
  181. /* ----------- QSTORES ----------- */
  182. void qstoretomem( unsigned char row, unsigned char col, unsigned char rows,
  183.                   unsigned char cols, void far *dest );
  184. void qstoretoscr( unsigned char row, unsigned char col, unsigned char rows,
  185.                   unsigned char cols, void far *src );
  186. void qscrtovscr(  unsigned char row, unsigned char col, unsigned char rows,
  187.                   unsigned char cols, unsigned char vrow, unsigned char vcol,
  188.                   unsigned char vwidth, void far *vscrptr );
  189. void qvscrtoscr(  unsigned char row, unsigned char col, unsigned char rows,
  190.                   unsigned char cols, unsigned char vrow, unsigned char vcol,
  191.                   unsigned char vwidth, void far *vscrptr );
  192.  
  193. /* ----------- QSCROLLS ----------- */
  194. void qscrollup(   unsigned char row, unsigned char col, unsigned char rows,
  195.                   unsigned char cols, int blankattr );
  196. void qscrolldown( unsigned char row, unsigned char col, unsigned char rows,
  197.                   unsigned char cols, int blankattr );
  198.  
  199. /* ----------- QPAGES ----------- */
  200. void qviewpage(  char pagenum );
  201. void qwritepage( char pagenum );
  202.  
  203. /* ----------- QREADS ----------- */
  204. void qreadstr(  char far *astr, char row, char col, char num );
  205. unsigned char qreadchar( unsigned char row, unsigned char col );
  206. unsigned char qreadattr( unsigned char row, unsigned char col );
  207.  
  208. /* ----------- QEOSLN ----------- */
  209. void qeosln( void );
  210.  
  211. /* ----------- CURSOR ----------- */
  212. int getcursor( void );
  213. void setcursor( int cursor );
  214. void modcursor( int modify );
  215. void gotorc( unsigned char row, unsigned char col );
  216. unsigned char wherer( void );
  217. unsigned char wherec( void );
  218.  
  219. /* ----------- EOS ----------- */
  220. void gotoeos( void );
  221. unsigned char eosr( void );
  222. unsigned char eosc( void );
  223. void eostorc( unsigned char row, unsigned char col );
  224. void eostorcrel( int row, int col );
  225. void eostocursor( void );
  226. void eosln( void );
  227.  
  228. /* ----------- CPUIDENT ----------- */
  229. void getcpuid( void );
  230.  
  231. /* ----------- GETSUBID ----------- */
  232. void get_submodel_id( void );           /* Read docs before using! */
  233.  
  234. /* ----------- SETMULTI ----------- */
  235. void setmultitask( void );
  236.